package employeedb;

import java.util.LinkedList;

/**
 *
 * @author Админ
 */
public class WorkerHandler {

    public static void sort(LinkedList<Worker> workers) {//сортировка пузырьком
        boolean t = true;
        while (t) {
            t = false;
            Worker tmp;
            for (int i = 0; i < workers.size() - 1; i++) {
                Worker a = workers.get(i);
                Worker b = workers.get(i + 1);
                if (a.getPayroll() >= b.getPayroll()) {
                    tmp = a;
                    workers.set(i, b);
                    workers.set(i + 1, tmp);
                    t = true;
                }
            }
        }
    }
}
